package com.aoyy.util;

import java.util.Date;
import java.util.Random;
import java.lang.StringBuffer;
import java.text.SimpleDateFormat;
/**==================================================================================
 * <code>StringFormatter</code> class is served for formatting <code>String</code>
 * @author Administrator
 * @date 2017-07-12
 * =================================================================================== */
public class StringFormatter {
  public static String getDefaultFileName() {
	SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmssSSSS");
	return formatter.format(new Date());
  }
  public static String getDateTimeStr() {
   	SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
   	return formatter.format(new Date());
  }
  
  public static String getDateStr() {
	SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
	return formatter.format(new Date());
  }
  
  public static String getOrderNo() {
	StringBuffer buffer = new StringBuffer();
	SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmssSSS");
	buffer.append(formatter.format(new Date()));
	Random random = new Random();
	for (int i = 0; i < 3; i++) {
	  buffer.append(random.nextInt(10));	
	}
	return buffer.toString();
  }
  
}
